package src.Packets;

import src.Main;
import src.Players.*;

public class SwitchItems
{
    public SwitchItems(Player p)
    {
        if(p == null)
        {
            return;
        }
        int interfaceId = p.inStream.readUnsignedWordA();
        p.inStream.readSignedByteC();
        int fromId = p.inStream.readUnsignedWordBigEndianA();
        int toId = p.inStream.readSignedWordBigEndian();
        switch (interfaceId)
        {
            case 3724:
                if(fromId < 0 || fromId > 27 || toId < 0 || toId > 27)
                {
                    break;
                }
                int tempI = p.items[fromId];
                int tempN = p.itemsN[fromId];
                p.items[fromId] = p.items[toId];
                p.itemsN[fromId] = p.itemsN[toId];
                p.items[toId] = tempI;
                p.itemsN[toId] = tempN;
                p.frame.resetItems(p, 3214);
		System.out.println(tempI+" : "+tempN);
            break;
            case 34453:
                if(fromId < 0 || fromId > Main.m.ge.item.maxBankSize || toId < 0 || toId > Main.m.ge.item.maxBankSize)
                {
                    break;
                }
                tempI = p.bankItems[fromId];
                tempN = p.bankItemsN[fromId];
                p.bankItems[fromId] = p.bankItems[toId];
                p.bankItemsN[fromId] = p.bankItemsN[toId];
                p.bankItems[toId] = tempI;
                p.bankItemsN[toId] = tempN;
                p.frame.resetBank(p);
            break;
        }
    }
}